﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FifteenPuzzleGUI
{
    class Tile
    {
        public int rowPos { get; set; }
        public int colPos { get; set; }

        public int xPos { get; set; }
        public int yPos { get; set; }

        public int height { get; set; }
        public int width { get; set; }

        public int value { get; set; }

        public Tile()
        {
            this.rowPos = 0;
            this.colPos = 0;
            this.xPos = 0;
            this.yPos = 0;
            this.height = 0;
            this.width = 0;
            this.value = 0;
        }

        public Tile(int row, int col, int x, int y, int hei, int wid, int val)
        {
            this.rowPos = row;
            this.colPos = col;
            this.xPos = x;
            this.yPos = y;
            this.height = hei;
            this.width = wid;
            this.value = val;
        }

        public bool contains( int x, int y)
        {
            if (this.xPos < x && (this.xPos + this.width) > x)
            {
                if (this.yPos < y && (this.yPos + this.height) > y)
                {
                    return true;
                }
            }
            return false;
        }




        public void draw( System.Drawing.Graphics g )
        {
            g.FillRectangle(System.Drawing.Brushes.Azure, new System.Drawing.Rectangle(xPos, yPos, height, width));
            g.DrawRectangle(new System.Drawing.Pen(new System.Drawing.SolidBrush(System.Drawing.Color.Black)), new System.Drawing.Rectangle(xPos, yPos, height, width)); 
            g.DrawString(value.ToString(), new System.Drawing.Font(System.Drawing.FontFamily.GenericSansSerif, 20), System.Drawing.Brushes.Black, (float)xPos + 2, (float)yPos + 2);

        }
    }
}
